package de.bwv.javaproject.FunnyTokens.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.SwingConstants;

import de.java.swing.extension.ui.ExtendedPanel;

/**
 * Mit dem {@link BorderPanel} werden am Rand der Karte die Randmarkierungen
 * dargestellt.
 * 
 * @author Patrick Haas
 * @date 30.01.2010
 * 
 * @version 1.0.0
 * 
 */
public class BorderPanel extends ExtendedPanel {

	private static final long serialVersionUID = 8885969689664886219L;

	private JLabel textLabel;

	public BorderPanel() {
		initialize();
	}

	public void setValue(int value) {
		textLabel.setText(((Integer) value).toString());
	}

	public int getValue() {
		try {
			return Integer.parseInt(textLabel.getText());
		} catch (NumberFormatException e) {
			return 0;
		}
	}

	private void initialize() {
		this.setLayout(new BorderLayout());

		textLabel = new JLabel();
		textLabel.setForeground(new Color(212, 201, 136));
		textLabel.setFont(new Font(textLabel.getFont().getFamily(), Font.PLAIN, textLabel.getFont().getSize()));
		textLabel.setHorizontalAlignment(SwingConstants.CENTER);
		textLabel.setVerticalAlignment(SwingConstants.CENTER);

		this.add(BorderLayout.CENTER, textLabel);

	}
}
